import * as bcrypt from 'bcryptjs';

const rounds = 10;

export const getHash = async (data: string) => {
  return await bcrypt.hash(data, await bcrypt.genSalt(rounds));
};

export const getHashSync = (data: string) => {
  return bcrypt.hashSync(data, bcrypt.genSaltSync(rounds));
};

export const compareHash = async (data: string, hash: string) => {
  return await bcrypt.compare(data, hash);
};

export const compareHashSync = (data: string, hash: string) => {
  return bcrypt.compareSync(data, hash);
};
